package com.longcai.piaojia.adapter;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;

import com.longcai.piaojia.R;
import com.longcai.piaojia.widget.GoodsEvaluateListView;
import com.zcx.helper.bound.BoundView;
import com.zcx.helper.bound.BoundViewHelper;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import java.util.List;

/**
 * Created by Administrator on 2015/6/1.
 */
public class GoodsEvaluateContentGridAdapter extends ArrayAdapter<String> {

    private LayoutInflater layoutInflater;
    private Context context;

    public GoodsEvaluateContentGridAdapter(Context context, List<String> objects) {

        super(context, 0, objects);

        this.context = context;

        layoutInflater = ((Activity)context).getLayoutInflater();

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder;

        String string = getItem(position);

        if(convertView == null){

            convertView = BoundViewHelper.boundView(viewHolder = new ViewHolder(), ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) layoutInflater.inflate(R.layout.item_goods_evaluate_content_grid, null)));

            convertView.setTag(viewHolder);

        }else{

            viewHolder = (ViewHolder) convertView.getTag();

        }

        return convertView;

    }

    private class ViewHolder{

        @BoundView(R.id.item_goods_evaluate_content_grid_iv) public ImageView item_goods_evaluate_content_grid_iv;

    }

}
